package com.dreamcar.auction.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.sql.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * PurchaseOrder entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "purchase_order", catalog = "assignment")
public class PurchaseOrder implements java.io.Serializable {

	// Fields

	private Integer idPurchaseOrder;
	private Bid bid;
	private Date date;
	private Request request;

	// Constructors

	/** default constructor */
	public PurchaseOrder() {
	}


	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_purchase_order", unique = true, nullable = false)
	public Integer getIdPurchaseOrder() {
		return this.idPurchaseOrder;
	}

	public void setIdPurchaseOrder(Integer idPurchaseOrder) {
		this.idPurchaseOrder = idPurchaseOrder;
	}

	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_bid")
	public Bid getBid() {
		return this.bid;
	}

	public void setBid(Bid bid) {
		this.bid = bid;
	}
	
	@Column(name="date")
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}

	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="id_request")
	public Request getRequest() {
		return request;
	}

	public void setRequest(Request request) {
		this.request = request;
	}
	
	

}